home *** CD-ROM | disk | FTP | other *** search
- #
- # Some tests to the COORD and COERCE commands.
- #
-
- a = point( 1, 2, 3 );
- point( coord( a, 0 ), coord( a, 1 ), coord( a, 2 ) );
-
- a = vector( 4, 5, 6);
- vector( coord( a, 0 ), coord( a, 1 ), coord( a, 2 ) );
-
- a = plane( 10, 11, 12, 13 );
- plane( coord( a, 0 ), coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
-
- #
- # On lists, it does what NTH is doing.
- #
- a = list( 11, 12.5, PI );
- coord( a, 3 );
-
- #
- # On a matrix, it extract a single number (out of 4 by 4 = 16)
- #
- view_mat;
- coord( view_mat, 0 );
- coord( view_mat, 2 );
- coord( view_mat, 15 );
-
- #
- # Note that the zero location is reserved for the weights in CTLPT;
- #
- a = ctlpt( E2, 1, 2 );
- ctlpt( E2, coord( a, 1 ), coord( a, 2 ) );
-
- a = ctlpt( E3, 3, 4, 5 );
- ctlpt( E3, coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
-
- a = ctlpt( P2, 6, 7, 8 );
- ctlpt( P2, coord( a, 0 ), coord( a, 1 ), coord( a, 2 ) );
-
- a = ctlpt( P3, 9, 10, 11, 12 );
- ctlpt( P3, coord( a, 0 ), coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
-
- #
- # From polygons/lines it extracts a poly if more than one poly
- # is in the list or a vertex from the poly if only one poly is found.
- #
- iritState("DumpLevel", 9);
- axes;
- coord( axes, 2 );
- coord( coord( axes, 2 ), 1 );
- iritState("DumpLevel", 1);
-
- #
- # From a curve and surface, it extracts a control point.
- #
- s45 = sin( pi / 4 );
- cbzr = list( ctlpt( P2, 1.0, 1.0, 0.0 ),
- ctlpt( P2, s45, s45, s45 ),
- ctlpt( P2, 1.0, 0.0, 1.0 ) );
- sbsp = list ( list( ctlpt( E3, 0.1, 0.0, 1.0 ),
- ctlpt( E3, 0.3, 1.0, 0.0 ),
- ctlpt( E3, 0.0, 2.0, 1.0 ) ),
- list( ctlpt( E3, 3.1, 0.0, 0.0 ),
- ctlpt( E3, 3.3, 1.0, 2.0 ),
- ctlpt( E3, 3.0, 2.0, 0.0 ) ),
- list( ctlpt( E3, 4.1, 0.0, 1.0 ),
- ctlpt( E3, 4.3, 1.0, 0.0 ),
- ctlpt( E3, 4.0, 2.0, 1.0 ) ) );
-
- cb = cbezier( cbzr );
- sb = sbspline( 3, 3, sbsp, list( list( 1, 1, 1, 2, 2, 2 ),
- list( KV_OPEN ) ) );
-
- coord( cb, 1 );
- coord( sb, 0 );
- coord( sb, 1 );
- coord( sb, 8 );
-
- #
- # And now the COERCE command.
- #
- a = vector(1, 2, 3 );
- coerce( a, point_type );
- coerce( a, plane_type );
- coerce( a, e2 );
- coerce( a, e5 );
- coerce( a, p2 );
- coerce( a, p3 );
-
- a = plane(10, 11, 12, 13 );
- coerce( a, point_type );
- coerce( a, vector_type );
- coerce( a, e1 );
- coerce( a, e4 );
- coerce( a, p1 );
- coerce( a, p5 );
-
- a = ctlpt(e1, 1 );
- coerce( a, vector_type );
- coerce( a, point_type );
- coerce( a, plane_type );
- coerce( a, e3 );
- coerce( a, e5 );
- coerce( a, p2 );
- coerce( a, p3 );
-
- a = ctlpt(p5, 0.7, 1, 2, 3, 4, 5 );
- coerce( a, vector_type );
- coerce( a, point_type );
- coerce( a, plane_type );
- coerce( a, e1 );
- coerce( a, e3 );
- coerce( a, p3 );
- coerce( a, p5 );
-
- iritState("DumpLevel", 9);
- circ = circle( vector( 0.25, 0.5, 0.5 ), 1.5 );
- coerce( circ, e3 );
- coerce( circ, p4 );
-
- srf = ruledSrf( cbezier( list( ctlpt( E3, -0.5, -0.5, 0.0 ),
- ctlpt( E3, 0.5, -0.5, 0.0 ) ) ),
- cbezier( list( ctlpt( E3, -0.5, 0.5, 0.0 ),
- ctlpt( E3, 0.5, 0.5, 0.0 ) ) ) );
- coerce( srf, e5 );
- coerce( srf, p2 );
-
- crv = cbspline( 3,
- list( ctlpt( P2, 1.0, 1.0, 0.0 ),
- ctlpt( P2, s45, s45, s45 ),
- ctlpt( P2, 1.0, 0.0, 1.0 ) ),
- list( KV_FLOAT ) );
- srf = sbspline( 3, 3,
- list( list( ctlpt( E3, 0.1, 0.0, 1.0 ),
- ctlpt( E3, 0.3, 1.0, 0.0 ),
- ctlpt( E3, 0.0, 2.0, 1.0 ) ),
- list( ctlpt( E3, 3.1, 0.0, 0.0 ),
- ctlpt( E3, 3.3, 1.0, 2.0 ),
- ctlpt( E3, 3.0, 2.0, 0.0 ) ),
- list( ctlpt( E3, 4.1, 0.0, 1.0 ),
- ctlpt( E3, 4.3, 1.0, 0.0 ),
- ctlpt( E3, 4.0, 2.0, 1.0 ) ) ),
- list( list( KV_FLOAT ),
- list( KV_FLOAT ) ) );
-
- coerce( crv, KV_OPEN );
- coerce( srf, KV_OPEN );
-
- iritState("DumpLevel", 1);
-